<?php
//note 获取get方式传递过来的数据
function get( $key ){
	$var = isset( $_GET[$key] ) ? addslashes( trim( $_GET[$key] ) ) : NULL;
	return $var;
}

//note 获取post方式传递过来的数据
function post( $key ){
	$var = isset( $_POST[ $key ] ) ? $_POST[ $key ] : NULL;
	
	if( is_array( $var ) ){
		$var = _deepArr( $var );
	}else{
		$var = addslashes( trim( $var ) );
	}
	return $var;
}

//note 数组递归
function _deepArr( $arr ){
	foreach( $arr as $k=>$v ){
		if( is_array( $v ) ){
			$arr[$k] = _deepArr( $v );
		}else{
			$arr[$k] = addslashes( trim( $v ) );
		}
	}
	return $arr;
}
